package com.nefu.huiyi.controller;

import com.nefu.huiyi.result.HttpResult;
import com.nefu.huiyi.service.PasswordService;
import com.nefu.huiyi.dto.PasswordResetRequest;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/password")
public class PasswordController {

    @Autowired
    private PasswordService passwordService;

    @PostMapping("/reset-password")
    @Operation(summary = "根据用户ID重置密码为默认值")
    public HttpResult<String> resetPassword(@RequestParam Integer userId) {
        boolean success = passwordService.resetPasswordToDefault(userId);
        return success ?
                HttpResult.success("密码已重置为默认密码") :
                HttpResult.failed("密码重置失败，用户可能不存在");
        }
    }